﻿using System;
using System.Text;

namespace Prototype
{
    public class UnderlinePen : IProduct
    {
        private char ulchar;

        public UnderlinePen(char ulchar)
        {
            this.ulchar = ulchar;
        }

        #region IProduct メンバ

        public void Use(string s)
        {
            Encoding enc = Encoding.GetEncoding("shift_jis");
            int length = enc.GetByteCount(s);

            Console.WriteLine("\"" + s + "\"");
            Console.Write(" ");

            for (int i = 0; i < length; i++)
            {
                Console.Write(ulchar);
            }

            Console.WriteLine();
        }

        public IProduct CreateClone()
        {
            return (IProduct)MemberwiseClone();
        }

        #endregion
    }
}
